<?php
namespace app\validate\crm;

use think\Validate;

/**
 * 诉讼订单验证器
 * @package app\validate\crm
 */
class LawsuitOrderValidate extends Validate
{
    /**
     * 验证规则
     * @var array
     */
    protected $rule = [
        'order_id' => 'require|integer',
        'customer_id' => 'require|integer',
        'is_member' => 'require|in:0,1',
        'is_first_order' => 'in:0,1',
        'order_type' => 'require|in:1,2',
        'entrusting_party_type' => 'require|in:1,2',
        'entrusting_party_name' => 'require|max:255',
        'opposing_party_type' => 'require|in:1,2',
        'opposing_party_name' => 'require|max:255',
        'contact_person' => 'require|max:50',
        'contact_phone' => 'max:20',
        'service_fee_pre' => 'require|float|min:0',
        'service_fee_post' => 'float|min:0',
        'case_type' => 'require',
        'case_type_other' => 'max:255',
        'civil_phase' => 'max:255',
        'criminal_phase' => 'max:255',
        'case_amount_range' => 'require|integer',
        'case_amount_other' => 'max:50',
        'lawsuit_request_elements' => 'max:255',
        'main_lawsuit_request' => 'max:1000',
        'business_manager' => 'max:50',
        'department_manager' => 'max:50',
        'contract_manager' => 'max:50',
        'finance_manager' => 'max:50',
        'lawsuit_manager' => 'max:50',
        'lead_lawyer' => 'max:50',
    ];
    
    /**
     * 验证提示
     * @var array
     */
    protected $message = [
        'order_id.require' => '订单ID不能为空',
        'order_id.integer' => '订单ID必须为整数',
        'customer_id.require' => '客户ID不能为空',
        'customer_id.integer' => '客户ID必须为整数',
        'is_member.require' => '是否会员不能为空',
        'is_member.in' => '是否会员格式错误',
        'is_first_order.in' => '是否首单格式错误',
        'order_type.require' => '下单类型不能为空',
        'order_type.in' => '下单类型格式错误',
        'entrusting_party_type.require' => '委托方类型不能为空',
        'entrusting_party_type.in' => '委托方类型格式错误',
        'entrusting_party_name.require' => '委托方名称不能为空',
        'entrusting_party_name.max' => '委托方名称长度不能超过255个字符',
        'opposing_party_type.require' => '相对方类型不能为空',
        'opposing_party_type.in' => '相对方类型格式错误',
        'opposing_party_name.require' => '相对方名称不能为空',
        'opposing_party_name.max' => '相对方名称长度不能超过255个字符',
        'contact_person.require' => '联系人不能为空',
        'contact_person.max' => '联系人长度不能超过50个字符',
        'contact_phone.max' => '联系电话长度不能超过20个字符',
        'service_fee_pre.require' => '前期费用不能为空',
        'service_fee_pre.float' => '前期费用必须为数字',
        'service_fee_pre.min' => '前期费用不能为负数',
        'service_fee_post.float' => '后期费用必须为数字',
        'service_fee_post.min' => '后期费用不能为负数',
        'case_type.require' => '案由不能为空',
        'case_type_other.max' => '其他案由长度不能超过255个字符',
        'civil_phase.max' => '民商阶段长度不能超过255个字符',
        'criminal_phase.max' => '刑事阶段长度不能超过255个字符',
        'case_amount_range.require' => '标的金额范围不能为空',
        'case_amount_range.integer' => '标的金额范围必须为整数',
        'case_amount_other.max' => '其他金额长度不能超过50个字符',
        'lawsuit_request_elements.max' => '诉讼请求要素长度不能超过255个字符',
        'main_lawsuit_request.max' => '主要诉讼请求长度不能超过1000个字符',
        'business_manager.max' => '商务经理姓名长度不能超过50个字符',
        'department_manager.max' => '部门主管姓名长度不能超过50个字符',
        'contract_manager.max' => '合同管理部负责人姓名长度不能超过50个字符',
        'finance_manager.max' => '财务管理部负责人姓名长度不能超过50个字符',
        'lawsuit_manager.max' => '诉讼管理部负责人姓名长度不能超过50个字符',
        'lead_lawyer.max' => '主办律师姓名长度不能超过50个字符',
    ];
    
    /**
     * 场景定义
     * @var array
     */
    protected $scene = [
        'create' => [
            'customer_id', 'is_member', 'is_first_order', 'order_type',
            'entrusting_party_type', 'entrusting_party_name', 'opposing_party_type',
            'opposing_party_name', 'contact_person', 'contact_phone', 'service_fee_pre',
            'service_fee_post', 'case_type', 'case_type_other', 'civil_phase',
            'criminal_phase', 'case_amount_range', 'case_amount_other',
            'lawsuit_request_elements', 'main_lawsuit_request', 'business_manager',
            'department_manager', 'contract_manager', 'finance_manager', 'lawsuit_manager',
            'lead_lawyer'
        ],
        'update' => [
            'order_id', 'customer_id', 'is_member', 'is_first_order', 'order_type',
            'entrusting_party_type', 'entrusting_party_name', 'opposing_party_type',
            'opposing_party_name', 'contact_person', 'contact_phone', 'service_fee_pre',
            'service_fee_post', 'case_type', 'case_type_other', 'civil_phase',
            'criminal_phase', 'case_amount_range', 'case_amount_other',
            'lawsuit_request_elements', 'main_lawsuit_request', 'business_manager',
            'department_manager', 'contract_manager', 'finance_manager', 'lawsuit_manager',
            'lead_lawyer'
        ],
    ];
}